package com.mzj.saas.mservice.house.repository;

import com.mzj.saas.mservice.house.entity.LockAudit;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;

public interface LockAuditRepository extends PagingAndSortingRepository<LockAudit,Long>, JpaSpecificationExecutor<LockAudit> {
    List<LockAudit> findByHouseId(String houseId);

    List<LockAudit> findByIdAndType(Long id,Integer type);

    @Modifying
    @Query(value = "UPDATE `saas_house_lock_audit` l SET l.status=?2 WHERE l.`house_id` = ?1", nativeQuery=true)
    int updateByHouseId(String houseId,Integer status);


}
